var code = "";
if (window.location.href.indexOf("code") != -1) {
    code = window.location.href.split("code=")[1].split("&state")[0];
}
$.ajax({
    url: Feng.ctxPath + "/integralMallWeixin/getMedicalRecordsInfo",
    type: "POST",
    data: {"code": code},
    success: function (data) {
        if (data == '' || data == null) {
            window.location.href = Feng.ctxPath + "/integralMallWeixin/logincus";
            return false;
        }
        var html = "";
        html += "<div class=\"medicalRecords\" style=\"height: 100%;font-size: 16px;\">\n" +
            "    <div class=\"integralMallHeadTop\">\n" +
            "        <div style=\"text-align: left\" onclick=\"goBackPersonalCenter()\"><span\n" +
            "                class=\"glyphicon glyphicon-menu-left\"></span></div>\n" +
            "        <div>就诊记录</div>\n" +
            "        <div></div>\n" +
            "    </div>\n" +
            "    <div id=\"aaa\" style=\"padding: 10px 10px 46px;height: calc(100% - 45px);overflow: auto;\">\n";
        for (var i = 0; i < data.length; i++) {
            /*if (data[i].status == "预约") {
                html += "<div class=\"alreadyAppointment\">\n" +
                    "                        <div style=\"margin-bottom:8px;border-bottom: 1px solid white;\">\n" +
                    "                        <span>" + data[i].startTime + "</span>\n" +
                    "                        <span  style=\"background:  white;color:  #ff9700;border-radius:  5px;padding:  3px  8px;margin-left:  10px;\">" + data[i].startTimes + "-" + data[i].endTimes + "</span>\n" +
                    "                        </div>\n" +
                    "                        <div><span>项目：</span><span>" + data[i].appointmentPayService + "</span></div>\n" +
                    "                    <div><span>医生：</span><span>" + data[i].doctor + "</span></div>\n" +
                    "                    <div><span>门店：</span><span>" + data[i].arrivalStore + "</span></div>\n" +
                    "                    </div>";
            } else */
                if (data[i].status == "到店") {
                html += "<div class=\"goToHospital\">\n" +
                    "            <div style=\"margin-bottom:8px;border-bottom: 1px solid white;\">\n" +
                    "                <span>" + data[i].startTime + "</span>\n" +
                    "                <span style=\"background:  white;color:  #ff9700;border-radius:  5px;padding:  3px  8px;margin-left:  10px;\">" + data[i].startTimes + "-" + data[i].endTimes + "</span>\n" +
                    "            </div>\n" +
                    "            <div><span>项目：</span><span>" + data[i].appointmentPayService + "</span></div>\n" +
                    "            <div><span>医生：</span><span>" + data[i].doctor + "</span></div>\n" +
                    "            <div><span>门店：</span><span>" + data[i].arrivalStore + "</span></div>\n" +
                    "        </div>";
            }
            if (data[i].arrivalStatus == "8") {
                html += "<div class=\"cancelled\">\n" +
                    "            <div style=\"margin-bottom:8px;border-bottom:  1px  solid  white;\">\n" +
                    "                <span>" + data[i].startTime + "</span>\n" +
                    "                <span style=\"background:  white;color:  #ff9700;border-radius:  5px;padding:  3px  8px;margin-left:  10px;\">" + data[i].startTimes + "-" + data[i].endTimes + "</span>\n" +
                    "            </div>\n" +
                    "            <div><span>项目：</span><span>" + data[i].appointmentPayService + "</span></div>\n" +
                    "            <div><span>医生：</span><span>" + data[i].doctor + "</span></div>\n" +
                    "            <div><span>门店：</span><span>" + data[i].arrivalStore + "</span></div>\n" +
                    "        </div>";
            }
        }
        html += " </div>\n" +
            "    <div class=\"integralMallFoot\">\n" +
            "        <button class=\"btn btn-primary btn-lg btn-block\" onclick=\"goBackPersonalCenter()\" type=\"button\">返回</button>\n" +
            "    </div>\n" +
            "</div>";
        $("#medicalRd").html(html);
    },
    error: function (data) {

    }
});